import React, { useReducer } from 'react';
// import { GlobalStyle } from '../../static/style'
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
import MyContext from '../../libs/context'
import { BrowserRouter } from 'react-router-dom'
import RouterView from '../../router/index'


function countReducer(state, action) {
  switch (action.type) {
    case 'add':
      console.log(state, 'state----state')
      state.count++
      return { ...state }
    case 'remove':
      state.count--;
      return { ...state }
    default:
      return { ...state }
  }
}

const App = () => {
  let [store, dispatch] = useReducer(countReducer, { count: 0 })
  let api = { store, dispatch }
  return (
    <div className="App">
      <MyContext.Provider value={api}>
        <BrowserRouter>
          <RouterView></RouterView>
        </BrowserRouter>
      </MyContext.Provider>
    </div>
  );
}

export default App;
